<template>
	<view>
		<u-form :model="form" ref="uForm" id="form-container">
			<view class="u-flex u-row-center">
				<u-form-item label="机台编号" :label-width="labelWidth" style="flex: 1;" required>
					<u-input v-model="form.machineId" @blur="getBindingUser"/>
				</u-form-item>
				<u-icon name="scan" color="#2979ff" size="80" @click="scanFun" style="margin-right: 20rpx;"></u-icon>
			</view>
			<!-- 新增----责任工号 -->
			<view v-for="(item,index) in jobnumberLists" :key="index">
				<u-form-item label="责任工号" :label-width="labelWidth" required>	
					<u-input :key="index" v-model="item.jobnumber" placeholder="请输入责任工号"/>
				</u-form-item>
			</view>
			<u-form-item label-width="80">
				<u-button type="info" size="mini" @click="addjobnumber">新增责任工号</u-button>
			</u-form-item>
			<u-form-item label="条码" :label-width="labelWidth" required>
				<u-input v-model="form.deviceBarCode" :disabled="special" />
			</u-form-item>
			<u-form-item label="订单编号" :label-width="labelWidth" required>
				<u-input v-model="form.orderPlanNo" :disabled="special" />
			</u-form-item>
			<u-form-item label="检验状态" :label-width="labelWidth" required v-if="user.departmentName != '喷涂车间'">
				<u-input v-model="form.examineType" type="select" :select-open="showExamineType" @click="showExamineType = true"/>
			</u-form-item>
			<u-form-item :label="examineTypeSize" :label-width="labelWidth" prop="examineSize" required v-if="user.departmentName != '喷涂车间'">
				<u-input v-model="form.examineSize" type="digit"/>
			</u-form-item>
			<!-- 抽检不良数不能大于MaxexamineNumber -->
			<u-form-item label="扫码数量" :label-width="labelWidth" required>
				<u-input v-model="form.MaxexamineNumber" type="digit"/>
			</u-form-item>
			<u-form-item label="抽检不良数" :label-width="labelWidth" prop="examineNumber" required>
				<u-input v-model="form.examineNumber"  @blur="maxData" type="digit"/>
			</u-form-item>
			<view v-for="(item, index) in disqualificationMouhouList" :key="index" v-if="user.departmentName == '喷涂车间'">
			    <u-form-item label="粉末类型" :label-width="labelWidth" required>
			    	<u-input v-model="item.powderType" type="select" :select-open="showpowderType" @click="showpowderTypeClick(index)"/>
			    </u-form-item>
			    <u-form-item  label="膜厚1" :label-width="labelWidth" prop="mohou1" required v-if="user.departmentName == '喷涂车间'">
			    	<u-input v-model="item.mohou1"/>
			    </u-form-item>
			    <u-form-item label="膜厚2" :label-width="labelWidth" prop="mohou2" required v-if="user.departmentName == '喷涂车间'">
			    	<u-input v-model="item.mohou2" type="digit"/>
			    </u-form-item>
			    <u-form-item label="膜厚3" :label-width="labelWidth" prop="mohou3" required v-if="user.departmentName == '喷涂车间'">
			    	<u-input v-model="item.mohou3" type="digit"/>
			    </u-form-item>
			    <u-form-item label="膜厚4" :label-width="labelWidth" prop="mohou4" required v-if="user.departmentName == '喷涂车间'">
			    	<u-input v-model="item.mohou4" type="digit"/>
			    </u-form-item>
			    <u-form-item label="膜厚5" :label-width="labelWidth" prop="mohou5" required v-if="user.departmentName == '喷涂车间'">
			    	<u-input v-model="item.mohou5" type="digit"/>
			    </u-form-item>
			</view>
			<u-form-item label-width="80" v-if="user.departmentName == '喷涂车间'">
				<u-button style="margin-right: 10rpx;" type="info" size="mini" @click="addMohou">新增粉末类型</u-button>
				<u-button v-if="disqualificationMouhouList.length > 1" type="error" size="mini" @click="delMohou">删除</u-button>
			</u-form-item>
<!-- 			<u-form-item label="检验工位ID" :label-width="labelWidth">
				<u-input v-model="form.checkStationId" disabled />
			</u-form-item> -->
			<u-form-item label="问题小类" prop="issueLittle" class="u-flex u-flex-nowrap" :label-width="labelWidthType" required>
				<div class="u-flex u-flex-nowrap u-row-between">
					<u-input v-model="form.issueLittle" />
					<u-button type="success" size="mini" @click="queryIssue">查询</u-button>
				</div>
			</u-form-item>
			<u-form-item label="问题大类" :label-width="labelWidth" required>
				<u-input v-model="form.issueLarge" disabled :placeholder="defaultReminder"/>
			</u-form-item>
			<u-form-item label="问题索引" :label-width="labelWidth" required>
				<u-input v-model="form.issueIndexes" disabled :placeholder="defaultReminder"/>
			</u-form-item>
			<u-form-item label="责任环节" :label-width="labelWidth" required>
				<u-input v-model="form.responsibility" disabled :placeholder="defaultReminder"/>
			</u-form-item>
			<u-form-item label="缺陷代码" :label-width="labelWidth" required>
				<u-input v-model="form.issueId" disabled :placeholder="defaultReminder"/>
			</u-form-item>
			<u-form-item label="问题性质" prop="natureId" :label-width="labelWidth" required>
				<u-input v-model="form.natureId" type="select" :select-open="showNature" @click="showNature = true"/>
			</u-form-item>
			<u-form-item label="描述" :label-width="labelWidth" prop="disqualificationDesc" required>
				<u-input v-model="form.disqualificationDesc" :type="type" :auto-height="autoHeight" placeholder="请输入不合格描述信息" />
			</u-form-item>
			<u-form-item label="图片上传" :label-widthw="labelWidth">
				<easy-upload
					:dataList="imageDataList" 
					:uploadUrl="setUploadUrl" 
					:deleteUrl="setDeleteUrl"
					:types="imageTypes"
					@deleteImage = "deleteFaImage"
					:autoUpload="setAutoUpload"
					@successImage="successImage"
					:uploadCount= "imageUpNumber"
				>
				</easy-upload>
			</u-form-item>
			<u-form-item label="视频上传" :label-widthw="labelWidth">
				<easy-upload
					:dataList="videoDataList" 
					:uploadUrl="setUploadUrl" 
					:deleteUrl="setDeleteUrl"
					@deleteVideo = "deleteFaVideo"
					:autoUpload="setAutoUpload"
					:types="videoTypes"
					@successVideo="successvideo"
				>
				</easy-upload>
			</u-form-item>
			<u-form-item label="处理结果" :label-width="labelWidth">
				<u-input
				v-model="form.examineResult" 
				placeholder="请输入处理结果" 
				type="textarea" 
				height="50"
				auto-height="true" 
				adjust-position="true"
				show-confirmbar="false"/>
			</u-form-item>
			<u-form-item label="改善措施" :label-width="labelWidth">
				<u-input
				v-model="form.improvementMeasure" 
				placeholder="请输入改善措施" 
				type="textarea" 
				height="50"
				auto-height="true" 
				adjust-position="true"
				show-confirmbar="false"/>
			</u-form-item>
			<u-form-item label="流程卡照片" :label-width="labelWidth" required>
				<u-upload
				ref="uUpload"
				:action="setUploadUrl"
				auto-upload="true"
				upload-text="流程卡照片"
				max-count="1"
				@on-success="sucess"
				@on-remove="remove"
				:show-progress="false"></u-upload>
			</u-form-item>
			<u-form-item class="u-flex u-row-center">
				<u-button type="success" size="medium" @click="submit">提交</u-button>
			</u-form-item>
		</u-form>
		<u-popup mode="right" v-model="popShow">
			<view class="content">
				<scroll-view scroll-y="true" style="height: 900rpx;width:300rpx">
					<view v-for="(item,index) in issueList" class="buttonGap" :key="index">
						<u-button type="success" size="mini"  @click="selectIssue(item)">{{ item.issueLittle }}——{{ item.issueLarge }}</u-button>
					</view>
				</scroll-view>
			</view>
		</u-popup>
		<u-action-sheet :list="list" v-model="showNature" @click="problemNatureSelect"></u-action-sheet>
		<u-action-sheet :list="statusList" v-model="showExamineType" @click="examineTypeSelect"></u-action-sheet>
		<u-action-sheet :list="powderTypeList" v-model="showpowderType" @click="powderTypeSelect"></u-action-sheet>
		<u-top-tips ref="uTips"></u-top-tips>
	</view>
</template>	
<script>
import { commitDisqualification,spraycommitDisqualification, issueIndexes,getMachineUser,getPtBindingUser,delFile } from '../../../utils/index.js'
	export default {
		data() {
			return {
				disqualificationMouhouList:[{
					powderType:'',
					mohou1: '',
					mohou2: '',
					mohou3: '',
					mohou4: '',
					mohou5: '',
				}],
				form: {
					planNo: '',					//排产编号
					orderPlanNo: '',			//订单号
					jobNumber: '',				//员工工号
					deviceBarCode: '',			//条形码
					disqualificationDesc: '',	//描述
					natureId: '',				//问题性质
					imageUrl: '',				//问题图片url
					videoUrl: '',				//问题视频ur
					issueId: '',				//缺陷代码
					issueLarge: '',				//问题大类
					issueIndexes: '',			//问题索引
					responsibility: '',			//责任环节
					issueLittle: '',			//问题小类
					examineSize: '',			//首检/巡检/终检数
					examineNumber: '',			//抽检不良数
					
					examineType: '',			//检验状态
					examineResult: '',			//处理结果
					improvementMeasure: '',		//改善措施
					machineId: ''
				},
				machineIds: '',				//自选机台编号
				jobNumbers: '',				//绑定机台的员工工号
				value: 'QC',					//单选框的默认值
				rules: {						//表单提交前的验证
					examineSize: [{
							required: true, 
							message: '请输入内容', 
							trigger: 'blur',
					}],
					examineNumber: [{
							required: true, 
							message: '请输入抽检不良数', 
							trigger: 'blur',
					}],
					natureId: [{
							required: true,
							message: '请输入问题性质', 
							trigger: 'blur',
					}],
					disqualificationDesc: [{
							required: true,
							message: '请输入描述', 
							trigger: 'blur',
					}]
					// powderType: [{
					// 		required: true,
					// 		message: '请选择粉末类型', 
					// 		trigger: 'change',
					// }],
					// mohou1: [{
					// 		required: true,
					// 		message: '请输入膜厚1', 
					// 		trigger: 'blur',
					// }],
					// mohou2: [{
					// 		required: true,
					// 		message: '请输入膜厚2', 
					// 		trigger: 'blur',
					// }],
					// mohou3: [{
					// 		required: true,
					// 		message: '请输入膜厚3', 
					// 		trigger: 'blur',
					// }],
					// mohou4: [{
					// 		required: true,
					// 		message: '请输入膜厚4', 
					// 		trigger: 'blur',
					// }],
					// mohou5: [{
					// 		required: true,
					// 		message: '请输入膜厚5', 
					// 		trigger: 'blur',
					// }],
				},
				defaultReminder: '请输入问题小类进行查询',
				popShow: false,			//弹出层的显示控制条件
				labelWidthType: 160,
				issueList: '',			//输入问题小类返回的与问题小类相关的数组数据
				labelWidth: 140,		//表单每一项的宽度
				autoHeight: true,		//表单“描述”输入框自动高度
				showExamineType: false,	//控制检验状态的显现
				examineTypeSize: '',	//检验状态数的小标题
				showNature: false,		//控制问题性质的显现
				// showType: false,		//控制问题类型的显现
				statusList: [					//检验状态的选项
					{
					  text: "首检"
					},
					{
					  text: "巡检"
					},
					{
					  text: "终检"
					}
				],
				list: [					//问题性质的选项
					{
					  text: "一般"
					},
					{
					  text: "轻微"
					},
					{
					  text: "严重"
					}
				],
				showpowderType: false,
				powderTypeList: [					//检验状态的选项
					{
					  text: "双层粉"
					},
					{
					  text: "单层粉"
					}
				],
				type: 'textarea',		//将描述的输入框设置为textarea
				setUploadUrl: "https://www.golwayhhln.top/hnsMes/fileTransmit/detectionFile",
				setDeleteUrl: "https://www.golwayhhln.top/hnsMes/fileTransmit/delFile",
				imageDataList: [],		//图片上传数据展示
				videoDataList: [],		//视频上传数据展示
				imageTypes: 'image',	//设置上传格式为图片
				videoTypes: 'video',	//设置上传格式为视频
				imageUpNumber: 3,		//设置上传图片最大数量
				setAutoUpload: true,		//设置自动上传图片
				flowPhoto: [],				//流程卡图片
				jobnumberLists: [],
				special: true,
				user: uni.getStorageSync('user'),
				mohouIndex: ''
			}
		},
		methods:{
			// 删除膜厚
			delMohou(){
				this.disqualificationMouhouList.pop()
			},
			// 新增膜厚
			addMohou(){
				this.disqualificationMouhouList.push(
				{
					powderType:'',
					mohou1: '',
					mohou2: '',
					mohou3: '',
					mohou4: '',
					mohou5: '',
				})
			},
			showpowderTypeClick(index){
				this.showpowderType = true
				this.mohouIndex = index
			},
			// 扫码输入机台号
			scanFun(){
				let that = this
				uni.scanCode({
					onlyFromCamera: true,
					success: function (res) {
						that.form.machineId = res.result
						that.getBindingUser()
					},
					fail() {
						console.log('识别失败')
					}
				})
			},
			async getBindingUser(){	
				if(!this.form.machineId) return
				this.jobnumberLists = []
				const {data} = this.user.departmentName == '喷涂车间'?await getPtBindingUser({ machineId: this.form.machineId }):await getMachineUser({ machineId: this.form.machineId })
				if(data.data.department == '喷涂车间'){
					if(data.data.user1){ this.jobnumberLists.push({jobnumber: data.data.user1}) }
					if(data.data.user2){ this.jobnumberLists.push({jobnumber: data.data.user2}) }
					if(data.data.user3){ this.jobnumberLists.push({jobnumber: data.data.user3}) }
					if(data.data.user4){ this.jobnumberLists.push({jobnumber: data.data.user4}) }
					if(data.data.user5){ this.jobnumberLists.push({jobnumber: data.data.user5}) }
					if(!data.data.user1 && !data.data.user2 && !data.data.user3 && !data.data.user4 && !data.data.user5){ this.jobnumberLists.push({jobnumber: ''}) }
				} else {
					if(data.data.jobNumber){ this.jobnumberLists.push({jobnumber: data.data.jobNumber}) }
					if(data.data.jobNumber2){ this.jobnumberLists.push({jobnumber: data.data.jobNumber2}) }
					if(data.data.jobNumber3){ this.jobnumberLists.push({jobnumber: data.data.jobNumber3}) }
					if(!data.data.jobNumber && !data.data.jobNumber2 && !data.data.jobNumber3){ this.jobnumberLists.push({jobnumber: ''}) }
				}
				// let jobNumber = data.data.jobNumber?data.data.jobNumber: ''
				// let jobNumber2 = data.data.jobNumber2?','+data.data.jobNumber2: ''
				// let jobNumber3 = data.data.jobNumber3?','+data.data.jobNumber3: ''
				// this.jobNumbers = jobNumber + jobNumber2 + jobNumber3
			},
			examineTypeSelect(index){
				uni.hideKeyboard();
				this.form.examineType = this.statusList[index].text
				this.examineTypeSize = this.statusList[index].text + '数'
			},
			powderTypeSelect(index){
				uni.hideKeyboard();
				this.disqualificationMouhouList[this.mohouIndex].powderType = this.powderTypeList[index].text
			},
			
			// 问题性质选项是数组，传入数组的index值，以此来确定选择了数组的第几项
			problemNatureSelect(index) {
				uni.hideKeyboard();
				this.form.natureId = this.list[index].text
			},
			maxData(){
				if(this.user.departmentName == '喷涂车间' && parseFloat(this.form.examineNumber)<=0){
					this.form.examineNumber = ''
					return this.$refs.uTips.show({
						title: '抽检不良数需大于0!',
						type: 'warning',
						duration: '2000'
					})
				} else if(this.user.departmentName == '喷涂车间' && parseFloat(this.form.examineNumber)>parseFloat(this.form.MaxexamineNumber)){
					this.form.examineNumber = ''
					return this.$refs.uTips.show({
						title: '抽检不良数不可超过扫码数量!',
						type: 'warning',
						duration: '2000'
					})
				}
			},
			// 表单验证
			submit() {
				console.log(this.disqualificationMouhouList);
				if(!this.form.machineId) return this.$refs.uTips.show({
					title: '请扫码/手动输入机台号!',
					type: 'warning',
					duration: '2000'
				})
				if(!this.jobnumberLists.some(item => item.jobnumber)) return this.$refs.uTips.show({
					title: '请输入至少一个责任工号!',
					type: 'warning',
					duration: '2000'
				})
				if(!this.form.deviceBarCode) return this.$refs.uTips.show({
					title: '请输入条码',
					type: 'warning',
					duration: '2000'
				})
				if(!this.form.orderPlanNo) return this.$refs.uTips.show({
					title: '请输入订单编号',
					type: 'warning',
					duration: '2000'
				})
				if(this.user.departmentName == '喷涂车间'){
					const bool = this.disqualificationMouhouList.every(item => item.powderType !== '' && item.mohou1 !== ''  && item.mohou2 !== '' && item.mohou3 !== '' && item.mohou4 !== '' && item.mohou5 !== '')
					if(!bool)  return this.$refs.uTips.show({
					title: '粉末类型或膜厚不能为空',
					type: 'warning',
					duration: '2000'
				})
				}
				if(!this.form.issueId && this.user.departmentName == '喷涂车间') return this.$refs.uTips.show({
					title: '请选择问题小类',
					type: 'warning',
					duration: '2000'
				})
				this.$refs.uForm.validate(valid => {
					if (valid) {
						console.log('验证通过')
						this.postForm()
					} else {
						this.$refs.uTips.show({
							title: '请完善表单数据!',
							type: 'warning',
							duration: '2000'
						})
					}
				})
			},
			// 提交整个表单，提交按钮绑定的函数
			async postForm() {
				if(!this.flowPhoto.length) return this.$refs.uTips.show({
					title: '请上传流程卡照片',
					type: 'warning',
					duration: '2000'
				})
				const query = Object.assign({},this.form)
				// 问题性质的处理
				query.natureId = query.natureId == '一般' ? '1' : query.natureId == '轻微' ? '2' : '3'
				query.imageUrl = this.imageDataList.join('|')
				query.examineType = this.form.examineType == '首检'?'1':
									this.form.examineType == '巡检'?'2':'3'
				query.machine = this.form.machineId
				query.jobNumber = this.jobnumberTostring(this.jobnumberLists)
				//流程卡照片只能一个
				query.flowPhoto = this.flowPhoto.length?this.flowPhoto[0]:''
				// 对视频的URL进行处理，视频只能上传一个
				query.videoUrl = this.videoDataList.join('|')
				if(!this.special) { query.next = 'yes' } else { query.next = 'no' }
				// if(this.user.departmentName == '喷涂车间'){ query.mohouAvg = (parseFloat(this.form.examineNumber)+parseFloat(this.form.examineNumber)/2 }
				if(this.user.departmentName == '焊接车间') { query.type = 2 }
				else if(this.user.departmentName == '数控车间') { 
					query.type = 1 
				} else if(this.user.departmentName == '喷涂车间'){
					query.type = 3
				}
				console.log('query',query);
				let keyStr = '';
				let times = 1;
				if(this.user.departmentName == '喷涂车间'){ 
					delete query.MaxexamineNumber
					delete query.ptindex
				    // 传路劲参数
				    for(let key in query) {
				    	if(times === 1) {
				    		keyStr += `?${key}=${query[key]}`;
				    	} else {
				    		keyStr += `&${key}=${query[key]}`;
				    	}
				    	times++;
				    }
				}
				console.log(keyStr);
				// 发送请求
				const {data} = this.user.departmentName == '喷涂车间'?await spraycommitDisqualification(keyStr, this.disqualificationMouhouList):await commitDisqualification(query)
				if(data.code == 1) {
					this.$refs.uTips.show({
						title: data.msg,
						type: 'success',
						duration: '2000'
					})
					if(this.user.departmentName == '喷涂车间') { uni.setStorageSync('ptexamineNumber', {ptexamineNumber: query.examineNumber,ptindex: this.form.ptindex}) }
					setTimeout(() =>{
						uni.navigateBack()
					},2000)
				} else {
					this.$refs.uTips.show({
						title:  data.msg,
						type: 'warning',
						duration: '2000'
					})
				}
			},
			jobnumberTostring(val){
				let str = []
				val.forEach(item => {
					if(item.jobnumber){str.push(item.jobnumber)}
				})
				return str.join(',')
			},
			// 将问题小类获取的参数填入表单
			selectIssue(value) {
				this.form.issueIndexes = value.issueIndexes
				this.form.issueLarge = value.issueLarge
				this.form.issueId = value.issueId
				this.form.responsibility = value.responsibility
				this.form.issueLittle = value.issueLittle
				this.popShow = false
			},
			// 输入问题小类来查找
			async queryIssue() {
				let query = {
					issueIndexes: this.form.issueLittle
				}
				query.workCenter = this.user.departmentName == '结构总装车间'?'装配车间':this.user.departmentName
				const { data } = await issueIndexes(query)
				if(data.code != '1') return this.$refs.uTips.show({
						title: data.msg,
						type: 'warning',
						duration: '2000'
					})
				this.issueList = data.data
				this.popShow = true
			},
			// 图片上传成功回调函数
			successImage(e){
				// 后台返回的图片存储地址放在consequence中
				let consequence = JSON.parse(e.data)
				if(consequence.code == '1') {
					this.$refs.uTips.show({
						title: '上传成功！',
						type: 'success',
						duration: '2000'
					})
					this.imageDataList.push(consequence.data.results)
					// this.form.imageUrl += consequence.data.results
					// this.form.imageUrl += '|'
				} else {
					this.$refs.uTips.show({
						title: '上传失败！',
						type: 'success',
						duration: '2000'
					})
				}
			},
			// 删除图片接口
			deleteFaImage(data) {
				this.imageDataList.splice(data,1)
			},
			// 删除图片接口
			deleteFaVideo(data) {
				this.videoDataList.splice(data,1)
			},
			// 视频上传成功回调函数
			successvideo(e) {
				let consequence = JSON.parse(e.data)
				if(consequence.code == '1') {
					this.$refs.uTips.show({
						title: '上传成功！',
						type: 'success',
						duration: '2000'
					})
					// this.form.videoUrl = consequence.data.results
					this.videoDataList.push(consequence.data.results)
				} else {
					this.$refs.uTips.show({
						title: '上传失败！',
						type: 'success',
						duration: '2000'
					})
				}
			},
			// 图片上传成功回调函数
			sucess(e){
				console.log('图片上传成功',e)
				let res = e.data
				if(res.code == '1') {
					this.$refs.uTips.show({
						title: '上传成功！',
						type: 'success',
						duration: '2000'
					})
					this.flowPhoto.push(res.results)
				} else {
					this.$refs.uTips.show({
						title: '上传失败！',
						type: 'success',
						duration: '2000'
					})
				}
			},
			// 移除图片回调函数
			remove(e){
				console.log('移除图片',e,this.flowPhoto)
				this.delFile(e)
			},
			async delFile(index){
				const { data } = await delFile({image: this.flowPhoto[index]})
				if(data.code == '1') {
					this.$refs.uTips.show({
						title: '移除成功！',
						type: 'success',
						duration: '2000'
					})
					this.flowPhoto.splice(index,1)
				} else {
					this.$refs.uTips.show({
						title: '移除失败！',
						type: 'success',
						duration: '2000'
					})
				}
			},
			addjobnumber(){
				this.jobnumberLists.push({jobnumber: ''})
			},
			
		},
		// 路由跳转传递过来的参数，表单中没有传递数据进去的参数均为undefined
		onLoad(option) {
			this.form = Object.assign({},option)
			console.log('form',this.form);
			if(uni.getStorageSync('user').departmentName != '喷涂车间'){ this.form.examineType = '首检' }
			this.examineTypeSize = '首检数'
			this.form.issueLittle = ''
			console.log(this.form)
			if(this.form.jobNumber){ this.jobnumberLists.push({jobnumber: this.form.jobNumber}) }
			if(this.form.jobNumber2){ this.jobnumberLists.push({jobnumber: this.form.jobNumber2}) }
			if(this.form.jobNumber3){ this.jobnumberLists.push({jobnumber: this.form.jobNumber3})}
			if(!this.form.jobNumber && !this.form.jobNumber2 && !this.form.jobNumber3){ this.jobnumberLists.push({jobnumber: ''}) }
			if(this.form.deviceBarCode == '' || this.form.deviceBarCode == 'undefined') {
				this.form.deviceBarCode = ''
				this.form.orderPlanNo = ''
				this.form.machineId = ''
				this.form.technologyNo = ''
				this.form.scanCount = ''
				this.form.processName = ''
				this.special = false
			}
			if(uni.getStorageSync('user').departmentName == '焊接车间' || uni.getStorageSync('user').departmentName == '喷涂车间'){
				uni.setNavigationBarTitle({
					title: '质检表单'
				});
			}
		},
		// 必须要在onReady生命周期，因为onLoad生命周期组件可能尚未创建完毕
		onReady() {
			this.$refs.uForm.setRules(this.rules);
		}
	}	
</script>

<style lang="scss" scoped>
.main-content {
	width: 100%;
}
#form-container ::v-deep .u-form-item {
	margin-top: 15rpx;
	padding: 10rpx 30rpx;
}
.content {
	padding: 24rpx;
	text-align: center;
}
.buttonGap {
	margin-top: 20rpx;
}
</style>
